package com.oocl.im.handle.impl;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import com.oocl.im.constants.Constants;
import com.oocl.im.eventbus.RxBus;
import com.oocl.im.entity.Protocol;
import com.oocl.im.handle.IHandle;

public class MsgHandle implements IHandle{

	@Override
	public void handle(Protocol protocol) {
		String content = (String) protocol.getParams().get(Constants.CONTENT);
		DateFormat formDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String time = formDate.format(System.currentTimeMillis());
		String msg = time+"  "+protocol.getParams().get(Constants.FROM) + ": " + content + "\n";  
		RxBus.get().post(msg);
		System.out.println("MsgHandle msg is: "+msg);
	}
	
}
